home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000172_icon-group-sender _Fri Jul 30 17:49:41 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  10KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id RAA24130
  4.     for icon-group-addresses; Fri, 30 Jul 1999 17:44:44 -0700 (MST)
  5. Message-Id: <199907310044.RAA24130@baskerville.CS.Arizona.EDU>
  6. From: gep2@terabites.com
  7. Date: Fri, 30 Jul 1999 18:16:13 -0500
  8. Subject: When Do You Keep A Quirk?
  9. To: icon-group@optima.CS.Arizona.EDU
  10. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  11. Status: RO
  12.  
  13. > Gordon Peterson makes an excellent argument for moving to a less quirky
  14. definition of basename, 
  15.  
  16. ...thank you...
  17.  
  18. > ...going so far as to purposely break older programs that might depend on the 
  19. quirks. 
  20.  
  21. Right.
  22.  
  23. Some years ago, I was the programmer in charge of Datapoint's disk operating 
  24. system.  Although the system was really quite reliable, we'd (only rarely) 
  25. occasionally seen problems of the Cluster Allocation Table (the bitmap of 
  26. available clusters on the disk) becoming corrupted.  This would eventually 
  27. result in clusters being cross-linked to more than one file, obviously resulting 
  28. in serious problems.  Other times, we'd sometimes simply "lose" space on the 
  29. disk that was no longer allocated to any file.
  30.  
  31. One day I was wondering about how it was that file close (and space 
  32. deallocation, including when a file was being totally deleted) function was able 
  33. to run so quickly, even for large files.  
  34.  
  35. In our system, we had a fixed number of disk controller buffers, and a fixed 
  36. number of Logical File Table entries (think of these as being similar the the 
  37. data referenced by a "file handle").  When deleting a file (or the end, unused 
  38. part of a file that had been extended) the system loaded the Cluster Allocation 
  39. Table into disk controller buffer zero, and the RIB (Retrieval Information 
  40. Block) for the file (detailing the locations and sizes of the allocated pieces 
  41. for the file) into the disk controller buffer corresponding to the LFT entry in 
  42. use when the file was being closed.  It then ran down through the appropriate 
  43. entries in the RIB, clearing bits in the CAT and rewriting the CAT and its 
  44. backup copy to disk when done.
  45.  
  46. As I thought about this, I realized that if one were using LFT entry zero to 
  47. close a file and deallocate space, the two blocks would be loaded into the same 
  48. buffer, resulting in (sometimes) extraneous entries in the CAT being cleared 
  49. (and for a variety of technical reasons, probably not worth going into here, 
  50. this tended to occur most often when a file that had been on the disk for a long 
  51. time had been moved or replaced) since now the CAT was being also used as if it 
  52. were the RIB of the file being closed as well.  
  53.  
  54. I couldn't imagine a program actually doing such a thing as closing a file using 
  55. LFT entry zero, but just as a precaution built into the system a feature that 
  56. would prevent the incorrect behavior by not allowing files to be closed and 
  57. their space deallocated when using that LFT entry.
  58.  
  59. It wasn't too long after that when one afternoon the programmer in charge of our 
  60. BASIC compiler came in, angry as all hell, pissed off at the change I've made 
  61. and complaining that BASIC needed to use LFT entry zero when deleting files... 
  62. and BINGO, we'd found the cause of the mysterious CAT corruption.  :-)
  63.  
  64. Anyhow, I tend to think that (if this BASENAME routine is actually used at all) 
  65. it's PROBABLY being used by people who are unaware of the bug, and using it 
  66. presuming that it works the way it sounds like it's supposed to work.  The 
  67. "quirky" behavior (i.e. LONGSTANDING BUG) probably results in a lot of "quirky 
  68. behavior" (i.e. LONGSTANDING BUGS) in the programs which use BASENAME, too.
  69.  
  70. When changing such an implementation detail, I'd think that a reasonable way to 
  71. handle that is to carefully document (preferably in a source file comment, 
  72. perhaps also in a more global README file or something) the "bug" that was 
  73. fixed, examples of previous and new behavior, and let it go at that.  The other 
  74. idea (about adding a mandatory third parameter) would be one way to make SURE 
  75. that programs using the routine had been made aware of the fix, and that someone 
  76. responsible for each such program had (hopefully) considered the behavior and 
  77. what mode they genuinely wanted.  (Leaving each of the perhaps-desired modes in 
  78. the routine, in this case, is no big deal and results in a routine only slightly 
  79. larger than it would be otherwise... therefore I don't see this as being a huge 
  80. issue).
  81.  
  82. > I am totally sympathetic to this point of view. I had a friend that worked on 
  83. the ANSI C standards committee. He frequently lamented that there were proposed 
  84. changes to C that every committee member agreed would make a for a better 
  85. language, but were voted down because they would break large, existing 
  86. applications. One has to weigh the cost of revising old programs with the 
  87. possible gains in new programs.
  88.  
  89. That's perhaps a very different issue, since there it may be much more difficult 
  90. to provide BOTH functionalities as options.  And here we're not talking about a 
  91. core language issue anyhow... BASENAME is only just an IPL routine (not even 
  92. part of the standard compiler runtime or anything) and the IPL is primarily used 
  93. as EXAMPLES of how stuff is done in Icon.  Although certainly some of the other 
  94. IPL routines use it (and in fact, that might be an interesting exercise... to 
  95. see if any of those programs count on the quirky behavior or leave it as just 
  96. another latent bug) it's not clear that the routine is hugely widely used 
  97. otherwise.  (And if, indeed, the correction would FIX a latent bug in each of 
  98. the IPL sources which call BASENAME, then that would reinforce the decision to 
  99. fix it, and reduce the worry about programs counting on the anachronistic, 
  100. buggy, Unix-y behavior).
  101.  
  102. > In the case of basename, there are over a dozen IPL sources that use
  103. basename. If these IPL programs have not been tested with the new version of
  104. basename, I would be very concerned about this change, for this can effect
  105. programs that are not even using basename directly. 
  106.  
  107. Are those IPL sources complete stand-alone programs, or lower-level functions 
  108. likely to have been designed into larger programs or systems?
  109.  
  110. > Of course, it is very hard to determine how much non-IPL code out there uses 
  111. basename, or how many programs depend on the quirks. 
  112.  
  113. Yes.  But there are probably at least as many programs which have latent bugs as 
  114. a result of the quirks... and I'd tend to believe that a program would count on 
  115. the routine behaving the way one would EXPECT it to behave (i.e. without bugs) 
  116. based on the description of what the routine is supposed to do.
  117.  
  118. Again, I'll point out that I'm not aware that the routine has ever been 
  119. documented as behaving with all the same bugs and flaws as the anachronistic 
  120. Unix routine historically called "basename" (and that's a VERY generic name, not 
  121. something like "fsprintx" or the like), and that in this business we don't have 
  122. eternal copyrights or trademarks on function names and ancient (buggy!) 
  123. implementations based on those names.
  124.  
  125. > As much as I prefer the new version of basename, making this change in the 
  126. short run is too risky.
  127.  
  128. You're entitled to your opinion... as are all the rest of us too.
  129.  
  130. > If and when we do wish to change the behavior of basename, there is a way to
  131. ease the migration path. We can write a procedure old_basename that has the
  132. old behavior, then add the following line to old source files:
  133.  
  134. >    $define basename old_basename
  135.  
  136. Personally, I don't see that that makes a whole lot of sense.  The change is 
  137. cosmetic at best, and more confusing to programmers who (forever) look at a 
  138. source file being edited and see 'basename' without being made aware of the 
  139. macro substitution.  If you're gonna change the routine, then let's change it 
  140. and be done with it.  At least adding a third (required) parameter would help 
  141. make it more obvious to programmers that this routine is NOT an Icon-implemented 
  142. clone of the archaic Unix "basename".
  143.  
  144. > One final point: could we please cut down on ending Icon group mailings with
  145. political or religious messages? I say this not because I disagree (or
  146. agree) with the religious / political / aesthetic views of the members of
  147. the group. It's just that the purpose of the group is to exchange
  148. information on the Icon programming language. This is not the place for
  149. discussion of these other topics.
  150.  
  151. I presume the writer is commenting on my sig file, which makes a statement 
  152. against SPAM E-mails, as well as reminding people of the **shameful** way in 
  153. which our congresscritters, sent to Washington promising to represent their 
  154. constituents, instead brazenly participated in the most outrageous orgy of 
  155. partisan, politically motivated bullshit (and CLEARLY contrary to the expressed 
  156. will of the majority of the voters) that this country has seen in as far back as 
  157. *I* (at almost 50) can remember.  While I do agree that this is NOT the forum to 
  158. dwell on discussions of that occurrence, I'll point out too that sig files are a 
  159. VERY longstanding way for people on the Internet to voice their opinions on a 
  160. variety of subjects (sort of a "bumpersticker for E-mail") and as such are an 
  161. important element of free speech.  If you don't like to put your stand on such 
  162. issues in your SIG file, then feel free not to.  But don't bitch about other 
  163. people who do so, just because it makes you uncomfortable to be reminded about 
  164. the kind of shameful bullshit that some politicos in this country seem to think 
  165. the public will forget about prior to the next elections.  Some of us have 
  166. longer memories than that!!!
  167.  
  168. Gordon Peterson
  169. http://web2.airmail.net/gep2/
  170. Support the Anti-SPAM Amendment!  Join at http://www.cauce.org/
  171. 12/19/98: the day the Conservatives demonstrated their scorn for their
  172.    fraudulent sham of representative government.  Voters, remember it!
  173.  
  174.